package mysql

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	GoodsName   string  `gorm:"type:varchar(30);not null;"`
	GoodsCover  string  `gorm:"type:varchar(255);not null;"`
	GoodsPrice  float64 `gorm:"type:decimal(10,2);not null;"`
	GoodsStock  int64   `gorm:"type:int;"`
	GoodsStatus int64   `gorm:"tinyint(1);default:1;"`
}

func (g *Goods) FindGoods(goodsId int64) error {
	return DB.Debug().Where("id=?", goodsId).Find(&g).Error
}
